<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>意达设计</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../css/dealer.css"/>
    <style type="text/css">
    	html,body{ width: 100%; height: 100%; overflow: hidden;}
    </style>
</head>
<body class="body">

<!-- header -->
<div class="detailheader">
	<a href="javascript:void(0);" onclick="api.closeWin();" class="retue" style="display: none;"></a>
</div>

<!-- contact -->
<div class="login">
	<div class="loginCnt">
		<h2>意达订货管理</h2>
		<div class="loginlist"><span class="icnbg1"></span><input type="text" placeholder="手机号/用户名" name="username"></div>
		<div class="loginlist"><span class="icnbg2"></span><input type="text" placeholder="请输入密码" name="password"></div>
		<div class="wjpwd"><a href="#" onclick='forget()'>忘记密码</a></div>
		<div class="logBnt"><input type="button" value="登录" onclick='login()'></div>
	</div>
</div>




</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../script/adaptive.js"></script>
<script type="text/javascript" src="../script/tabs.js"></script>

<script type="text/javascript" src="../layer/layer.js"></script>
<!-- <script type="text/javascript" src="../layer/layer.js"></script> -->
<script type="text/javascript">
    window['adaptive'].desinWidth = 750;
    window['adaptive'].baseFont = 28;
    window['adaptive'].maxWidth = 750;
    window['adaptive'].init();
   
           
   
        apiready = function () {
            $api.fixStatusBar($api.dom('.header'));
            api.addEventListener({
                name: 'keyback'
            }, function(ret, err){
                api.closeWidget();
            });
            
            //api.showProgress();

            $api.clearStorage ();

           

/*var list = [{'goodsid':'111111'},{'number':'222'},{'color':'333'}];

        alert(JSON.stringify(list));
        var cart=JSON.stringify(list);*/


          

        }
        
        function login(){
            var username=$("input[name=username]").val();
            var password=$("input[name=password]").val();
            if(username==''){
                api.alert({msg:"请输入用户名！"});return;
            }else if(password==''){
                api.alert({msg:"请输入密码！"});return;
            }

            var p={username:username,password:password};
            api.ajax({
                url: webSiteUrl+'/app/public/login',
                method: 'post',
                data: {
                    
                    values: p
                }
            }, function(ret, err) {

                if(ret.code==200){
                    
                   $api.clearStorage();
                   $api.setStorage('user',ret.data);
                   //alert(JSON.stringify(ret.data));
                  
                   if(ret.data.vip==0){
                        api.openWin({
                            name: 'slideName',
                            url: './usercenter.html',
                            pageParam: {
                                name: 'text'
                            }
                        });
                   }else{
                        api.openWin({
                            name: 'dealer2Name',
                            url: './usercenter.html',
                            reload: true,
                            pageParam: {
                                name: 'text'
                            }
                        });
                   }
                }else{alert(ret.msg)}
            });

        }
        function forget(){
            api.openWin({
                name: 'dealer1Name',
                url: './forget.html',
                pageParam: {
                    name: 'text'
                }
            });
        }



    
</script>

</html>
